Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIO-7481: handle 504 response from service worker in offline mode for file request #5405

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

roma-formio
Copy link
Contributor

@roma-formio roma-formio commented Nov 15, 2023

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-7481

Description

Added condition to check response status for file upload requests. More information about 504 status from the service worker can be found on angular documentation Service worker requests when the server can't be reached.
Although there were many potential solutions:

  1. Check by 504 status code
  2. Include 'ngsw-bypass' header in a specific request to let the service worker know that he should skip this request and allow to do it directly to the server. (I don't think it's the best idea to include specific header for angular in our core library)
  3. Extend our 'fix-sw' gulp task in the form manager to check the request URL and skip service worker safe fetch when our request points to any storage.

I've chosen this solution because we already have a check by 504 status code to perform offline operations.

How has this PR been tested?

Manual testing.

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

Copy link
Contributor

@brendanbond brendanbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skimmed the documentation you linked, but I'm not sure I fully understand how re-throwing a 504 enables the file component to do it's work in the offline plugin; can we discuss in dev support?

EDIT: Thanks @roma-formio - I didn't see your comment in the Jira ticket that said this already works as expected except in certain scenarios.

@brendanbond brendanbond merged commit b564156 into master Nov 21, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants